/*
 * @lc app=leetcode.cn id=232 lang=csharp
 *
 * [232] 用栈实现队列
 */

// @lc code=start
public class MyQueue {
    private Stack<int> inStack = new Stack<int>();
    private Stack<int> outStack = new Stack<int>();
    public MyQueue() {
        
    }
    
    public void Push(int x) {
        inStack.Push(x);
    }
    
    public int Pop() {
        if(outStack.Count == 0)
        {
            while(inStack.Count > 0)
                outStack.Push(inStack.Pop());
        }
        return outStack.Pop();
    }
    
    public int Peek() {
        if(outStack.Count == 0)
        {
            while(inStack.Count > 0)
                outStack.Push(inStack.Pop());
        }
        return outStack.Peek();
    }
    
    public bool Empty() {
        return inStack.Count == 0 && outStack.Count == 0;
    }
}

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue obj = new MyQueue();
 * obj.Push(x);
 * int param_2 = obj.Pop();
 * int param_3 = obj.Peek();
 * bool param_4 = obj.Empty();
 */
// @lc code=end

